<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Home</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">

    <link rel="stylesheet" href="css/animate.css">
    <link rel="stylesheet" href="css/icomoon.css">
    <link rel="stylesheet" href="css/themify-icons.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/magnific-popup.css">
    <link rel="stylesheet" href="css/owl.carousel.min.css">
    <link rel="stylesheet" href="css/owl.theme.default.min.css">
    <link rel="stylesheet" href="css/style.css">
    <script src="js/modernizr-2.6.2.min.js"></script>
    <script src="js/respond.min.js"></script>

</head>
<body>

<nav class="gtco-nav" role="navigation">
    <div class="gtco-container">

        <div class="row">
            <div class="col-sm-4 col-xs-12">
                <div id="gtco-logo"><a href="index.html">panzh <em>.</em></a></div>
            </div>
            <div class="col-xs-8 text-right menu-1">
                <ul>
                    <li><a href="features.html">攀枝花简介</a></li>
                    <li><a href="tour.html">攀枝花旅游</a></li>
                    <li class="has-dropdown">
                        <a href="#">攀枝花特产</a>
                        <ul class="dropdown">
                            <li><a href="#">芒果</a></li>
                            <li><a href="#">石榴</a></li>
                            <li><a href="#">大盘鸡</a></li>
                        </ul>
                    </li>
                    <li><a href="contact.html">联系我们</a></li>
                    <li class="btn-cta"><a href="#"><span>网站首页</span></a></li>
                </ul>
            </div>
        </div>

    </div>
</nav>

<header id="gtco-header" class="gtco-cover" role="banner" style="background-image: url(images/img_4.jpg)">
    <div class="overlay"></div>
    <div class="gtco-container">
        <div class="row">
            <div class="col-md-12 col-md-offset-0 text-left">


                <div class="row row-mt-15em">
                    <div class="col-md-7 mt-text animate-box" data-animate-effect="fadeInUp">
                        <span class="intro-text-small">攀枝花智慧旅游后台网站</span>
                        <h1>智慧旅游后台网站系统</h1>
                    </div>
                    <div class="col-md-4 col-md-push-1 animate-box" data-animate-effect="fadeInRight">
                        <div class="form-wrap">
                            <div class="tab">
                                <ul class="tab-menu">
                                    <li class="active gtco-first"><a href="#" data-tab="signup">注册</a></li>
                                    <li class="gtco-second"><a href="#" data-tab="login">登录</a></li>
                                </ul>
                                <div class="tab-content">
                                    <div class="tab-content-inner active" data-content="signup">
                                        <form action="#">
                                            <div class="row form-group">
                                                <div class="col-md-12">
                                                    <label for="username">账号</label>
                                                    <input type="text" class="form-control" id="regisUsername">
                                                </div>
                                            </div>
                                            <div class="row form-group">
                                                <div class="col-md-12">
                                                    <label for="password">密码</label>
                                                    <input type="password" class="form-control" id="regisPassword">
                                                </div>
                                            </div>
                                            <div class="row form-group">
                                                <div class="col-md-12">
                                                    <label for="regisPassword2">请再次输入密码</label>
                                                    <input type="password" class="form-control" id="regisPassword2">
                                                </div>
                                            </div>

                                            <div class="row form-group">
                                                <div class="col-md-12">
                                                    <button id="registerBtn" class="btn btn-primary" value="注册">注册
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>

                                    <div class="tab-content-inner " data-content="login">
                                        <div class="row form-group">
                                            <div class="col-md-12">
                                                <label for="username">账号</label>
                                                <input type="text" class="form-control" id="username">
                                            </div>
                                        </div>
                                        <div class="row form-group">
                                            <div class="col-md-12">
                                                <label for="password">密码</label>
                                                <input type="password" class="form-control" id="password">
                                            </div>
                                        </div>

                                        <div class="row form-group">
                                            <div class="col-md-12">
                                                <button id="loginBtn" class="btn btn-primary" value="登录">登录</button>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>
    </div>
</header>


<div class="gototop js-top">
    <a href="#" class="js-gotop"><i class="icon-arrow-up"></i></a>
</div>

<input type="hidden" id="returnURL" th:value="${returnURL}">
<input type="hidden" id="ipAddr" th:value="${ipAddr}">

<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- jQuery Easing -->
<script src="js/jquery.easing.1.3.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- Waypoints -->
<script src="js/jquery.waypoints.min.js"></script>
<!-- Carousel -->
<script src="js/owl.carousel.min.js"></script>
<!-- countTo -->
<script src="js/jquery.countTo.js"></script>
<!-- Magnific Popup -->
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/magnific-popup-options.js"></script>
<!-- Main -->
<script src="js/main.js"></script>
<script src="layer/layer.js"></script>

<script>
    $(function () {
        $("#registerBtn").click(function () {
            layer.msg("当前不能进行注册！请登录")
        });

        $("#loginBtn").click(function () {
            //alert("sdf");
            var useId = $("#username").val();
            var pws = $("#password").val();
            //进行表单的验证；
            var patt = /^\d{6,12}$/; //这是一个正则对象
            if (!patt.test(useId.toString())) {
                layer.msg("您输入的账号有误，请重新输入！");
                return;
            }
            patt = /([a-zA-Z0-9]|[._]){5,17}$/;

            if (!patt.test(pws.toString())) {
                layer.msg("您输入的密码格式有问题，请重新输入！");
                return;
            }
            // 进行异步登录
            $.ajax({
                "url": "dologin",
                "data": {
                    "phoneNum": useId,
                    "passwd": pws,
                },
                "dataType": "json",
                "error": function (response) {
                    alert("服务器异常，请联系管理员！！");
                    return;
                },
                "success": function (response) {
                    var result = response.result;  //接收后台返回的数据；
                    if (result == "FAILED") {
                        // alert(response.data);
                        layer.msg(response.message);
                        return;
                    } else {
                        layer.msg("登陆成功");
                        var url = $("#returnURL").val();
                        var token = response.data;
                        window.open(url + "?newToken=" + token);
                        // window.location.href = "www.baidu.com";//进行页面的跳转；
                    }
                }
            })
        });
    });

</script>

</body>
</html>

